<template>
  <div>
    <el-dropdown trigger="click" @command="changeLanguage">
      <div>
        <svg-icon icon-class="language" style="color:#fff;font-size:20px" />
      </div>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item command="zh" :disabled="$i18n.locale === 'zh'">中文</el-dropdown-item>
        <el-dropdown-item command="en" :disabled="$i18n.locale === 'en'">en</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
import Cookie from 'js-cookie'
export default {
  data() {
    return {

    }
  },
  created() {

  },
  mounted() {

  },
  methods: {
    changeLanguage(lang) {
      Cookie.set('language', lang)
      this.$i18n.locale = lang
      this.$message.success('切换语言成功！')
    }
  }
}
</script>

<style scoped lang="less">

</style>
